package com.itheima.pojo;

import lombok.Data;

/**
 * 后端统一返回结果
 */
@Data
public class Resultwo {

    private Integer code; //编码：1成功，0为失败
    private String msg; //错误信息
    private Object data; //数据

    public static Resultwo success() {
        Resultwo resultwo = new Resultwo()
                ;
        resultwo.code = 1;
        resultwo.msg = "success";
        return resultwo;
    }

    public static Resultwo success(Object object) {
        Resultwo Resultwo = new Resultwo();
        Resultwo.data = object;
        Resultwo.code = 1;
        Resultwo.msg = "success";
        return Resultwo;
    }

    public static Resultwo error(String msg) {
        Resultwo Resultwo = new Resultwo();
        Resultwo.msg = msg;
        Resultwo.code = 0;
        return Resultwo;
    }

}
